<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="/js/fileuploader/fileuploader.css" type="text/css" media="screen" title="default" />
	<!--<script src="/js/fileuploader/fileuploader.js" type="text/javascript"></script> -->
	<script src="/js/fileuploader/fileuploader.min.js" type="text/javascript"></script> 
</head>
<body style="background-color: transparent">
<form id="id-form" name="frm" id="frm" method="post" action="/admin/store/save">
    <input type="hidden" id="STOREID" name="STOREID" value="<?= $this->data['STOREID']; ?>" />
	<table >
		<tr>
			<b>Hình ảnh đại diện hoặc Logo cửa hàng ( <font color="red">* </font> )</b>
			<input type="hidden" name="logofilename" id="logofilename" value=<?=$this->logolnk;?> />			
        </tr>
		
		<tr>
			<td>
				<div id="file-uploader-logo">		
					<noscript>			
						<p>Please enable JavaScript to use file uploader.</p>
						<!-- or put a simple form for upload here -->
					</noscript>   
				</div>
				<img name="logo" id="logo" style="display:<?if($this->logolnk == "") echo 'none'; else echo ''; ?>" width=120px height=120px src="<?echo $this->logolnk;?>"/>
				<!-- <div class="qq-upload-extra-drop-area">Drop files here too</div> -->
			</td>
        </tr>		
		
        <tr>
        	<td><b>
        	Tên cửa hàng ( <font color="red">* </font>)
			</b>
			</td>
		</tr>
		<tr>
        	<td colspan="10">
				<input class="inp-form" id="NAME" name="NAME" value="<?=$this->data['NAME']; ?>" type="text"/>
        	</td>
			<td nowrap="nowrap"></td>
        	<td>        	
        	</td>
			<td nowrap="nowrap"></td>
        	<td>        	
        	</td>
        </tr>
        
		<tr>  	
        	<td nowrap="nowrap"><b>Loại cửa hàng</b></td>        	
		</tr>
		<tr>
			<!--Start of combobox-->
			<td colspan="10">                    
				<select style="width: 200px; height:30px" id="STORECATEGORYID" name="STORECATEGORYID">
					<option value="">-- Chọn loại cửa hàng --</option>
					<?php 
						echo $this->htmlComboStorecategory;						
					?>
				</select>                   
				<br />               
			<!--End of combobox-->
        	</td> 
        	<td>        	
        	</td>
        	<td>        	
        	</td>
		</tr> 
		
		<tr>
        	<td><b>
        	Mô tả chi tiết
			</b>
        	</td>
		</tr>
		<tr>
        	<td width="650px">
				<!--<textarea rows="15" cols="100" id="DESCRIPTION" name="DESCRIPTION" VALUE="<--?= $this->data['DESCRIPTION']; ?>" />-->
				<?php common::ckeditor('DESCRIPTION', $this->data['DESCRIPTION']); ?>
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5"><b>
        	Mức giá</b>	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="LOWESTPRICE" name="LOWESTPRICE" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;			
			Đến
			<input class="inp-form" id="HIGHESTPRICE" name="HIGHESTPRICE" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	</td>
        </tr>
		
		<tr >
        	<td><b>
        	Giờ mở cửa</b>
        	</td>
        	<td >
			</td>
            <td nowrap="nowrap"></td>
        	<td>				
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 2
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	
			<select style="width: 70px; height:24px" id="workingtime_hour2_from" name="workingtime_hour2_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
					
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min2_from" name="workingtime_min2_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>
			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour2_to" name="workingtime_hour2_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min2_to" name="workingtime_min2_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>	
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 3
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour3_from" name="workingtime_hour3_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min3_from" name="workingtime_min3_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>	
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour3_to" name="workingtime_hour3_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min3_to" name="workingtime_min3_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>		
			<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime3" name="getsametime3" type="button" onclick="getsametime(3)" value="Lấy thời gian như trên"/>
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 4
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour4_from" name="workingtime_hour4_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min4_from" name="workingtime_min4_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour4_to" name="workingtime_hour4_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min4_to" name="workingtime_min4_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>	
			<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime4" name="getsametime4" type="button" onclick="getsametime(4)" value="Lấy thời gian như trên"/>			
        	</td>			
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 5
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour5_from" name="workingtime_hour5_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min5_from" name="workingtime_min5_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>		
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour5_to" name="workingtime_hour5_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min5_to" name="workingtime_min5_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>
			<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime5" name="getsametime5" type="button" onclick="getsametime(5)" value="Lấy thời gian như trên"/>				
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 6
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour6_from" name="workingtime_hour6_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min6_from" name="workingtime_min6_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour6_to" name="workingtime_hour6_to" value="">
				<option value="">Giờ</option>
				<?php
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min6_to" name="workingtime_min6_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>	
			<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime6" name="getsametime6" type="button" onclick="getsametime(6)" value="Lấy thời gian như trên"/>			
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 7
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour7_from" name="workingtime_hour7_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min7_from" name="workingtime_min7_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour7_to" name="workingtime_hour7_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min7_to" name="workingtime_min7_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>							
        	<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime7" name="getsametime7" type="button" onclick="getsametime(7)" value="Lấy thời gian như trên"/>
			</td>			
        </tr>
		
		<tr >
        	<td colspan="5">
        	Chủ nhật
			
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			
			Từ 
        	<select style="width: 70px; height:24px" id="workingtime_hour8_from" name="workingtime_hour8_from" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i;
						echo '">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min8_from" name="workingtime_min8_from" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			Đến
			<select style="width: 70px; height:24px" id="workingtime_hour8_to" name="workingtime_hour8_to" value="">
				<option value="">Giờ</option>
				<?php 
					for($i = 0; $i < 24; $i++){
						echo '<option value="'.$i.'">'.$i.'</option>';
					}					
				?>
			</select>   
			<select style="width: 70px; height:24px" id="workingtime_min8_to" name="workingtime_min8_to" value="">
				<option value="">Phút</option>
				<?php 
					for($i = 0; $i < 60; $i++){
						if($i%15 == 0)
						{
							echo '<option value="'.$i.'">'.$i.'</option>';
						}
					}					
				?>
			</select>	
			<!--Lấy thông tin giờ phút như ở trên-->
			<input id="getsametime8" name="getsametime8" type="button" onclick="getsametime(8)" value="Lấy thời gian như trên"/>
			
        	</td>
        </tr>
		
		<tr>
        	<td colspan="5">
				<input class="inp-form" type="hidden" id='WORKINGTIME' value="<?=$this->data['WORKINGTIME']?>" name="WORKINGTIME" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Email</b></td>
		</tr>
		<tr>
        	<td colspan="5">
				<input class="inp-form" type="textbox" id='EMAIL' value="<?=$this->data['EMAIL']; ?>" name="EMAIL" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Điện thoại</b></td>
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='PHONE' value="<?=$this->data['PHONE']; ?>" name="PHONE" />
			</td>			
        </tr>

		<tr>  	
        	<td><b>Link Facebook</b></td
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='FACEBOOKURL' value="<?=$this->data['FACEBOOKURL']; ?>" name="FACEBOOKURL" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Địa chỉ Website</b></td>
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='SITEURL' value="<?=$this->data['SITEURL']; ?>" name="SITEURL" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Địa chỉ</b> ( Bạn phải ghi địa chỉ thật rõ ràng, chính xác để có thể hiển thị bản đồ)</td>
		</tr>
		<tr>
        	<td>
			<input class="inp-form" type="textbox" id='ADDRESS' value="<?=$this->data['ADDRESS']; ?>" name="ADDRESS" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			<a onclick="xemBanDo()"><u><i>xem bản đồ</i></u></a>
			</td> 			
        </tr>
		
		<tr>  	
        	<td colspan="5">
			
			<b>Tỉnh thành</b>
			&nbsp;&nbsp;
			&nbsp;&nbsp;      	
			
			<!--Start of combobox-->              
				<select style="width: 200px; height:30px" id="CITYID" name="CITYID" onchange="if(this.value) changedCity(this.value)">
					<option value="">-- Chọn tỉnh thành --</option>
					<?php 
						foreach($this->listTinhThanh as $item){
								echo '<option value="'.$item['CITYID'].'" ';
								if($item['CITYID'] == $this->data['CITYID']){
									echo 'selected';
									$this->city = $item['NAME'];
								}
								else 
									echo '';
								echo '><b>'.$item['NAME'].'</b></option>';								
						}
					?>
				</select>                   				       
			<!--End of combobox-->
			<input class="inp-form" type="hidden" id='CITY' value="<?=$this->city; ?>" name="CITY" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<b>Quận huyện</b>&nbsp;&nbsp;&nbsp;&nbsp;
			<!--Start of combobox-->			                  
				<select style="width: 200px; height:30px" id="DISTRICTID" name="DISTRICTID" value="">
					<option value="">-- Chọn quận huyện --</option>					
				</select> 
				<input class="inp-form" type="hidden" id='DISTRICT' value="<?=$this->district; ?>" name="DISTRICT" />
			<!--End of combobox-->
			<br />        
        	</td> 
		</tr> 
		
        <tr> 
			<td nowrap="nowrap"><b>Bộ sưu tập hình ảnh ( tối đa 7 hình )</b></td>    			
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 1 &nbsp;&nbsp;&nbsp;&nbsp;
			<input type="hidden" name="image1filename" id="image1filename" value=<?=$this->image1lnk;?> />
			<div id="file-uploader-demo1">		
				<noscript>			
					<p>Please enable JavaScript to use file uploader.</p>
					<!-- or put a simple form for upload here -->
				</noscript>         					
			</div>
			<img name="image1" id="image1" style="display:<?if($this->image1lnk == "") echo 'none'; else echo ''; ?>" width=120px height=120px src="<?echo $this->image1lnk;?>"/>			
				<!-- <div class="qq-upload-extra-drop-area">Drop files here too</div> -->
			</td>
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 2 &nbsp;&nbsp;&nbsp;&nbsp;
			<input type="hidden" name="image2filename" id="image2filename" value=<?=$this->image2lnk;?> />
			<div id="file-uploader-demo2">		
				<noscript>			
					<p>Please enable JavaScript to use file uploader.</p>
					<!-- or put a simple form for upload here -->
				</noscript> 				
			</div>
			<img name="image2" id="image2" style="display:<?if($this->image2lnk == "") echo 'none'; else echo ''; ?>" width=120px height=120px src="<?echo $this->image2lnk;?>"/>				
				<!-- <div class="qq-upload-extra-drop-area">Drop files here too</div> -->
			</td>
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 3 &nbsp;&nbsp;&nbsp;&nbsp;
			<input type="hidden" name="image3filename" id="image3filename" value=<?=$this->image3lnk;?> />
			<div id="file-uploader-demo3">		
				<noscript>			
					<p>Please enable JavaScript to use file uploader.</p>
					<!-- or put a simple form for upload here -->
				</noscript>	
			</div>
			<img name="image3" id="image3" style="display:<?if($this->image3lnk == "") echo 'none'; else echo ''; ?>" width=120px height=120px src="<?echo $this->image3lnk;?>"/>		
				<!-- <div class="qq-upload-extra-drop-area">Drop files here too</div> -->
			</td>
		</tr> 
		
        <tr>  	
        	<td>Kích hoạt
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="checkbox" name="STATUS" id="STATUS" <?=(isset($this->data['STATUS']) && $this->data['STATUS'] == "1" ? "checked=''":''); ?>/>
			</td>			
        </tr>
		
		<tr>		
        </tr>	
		
		<tr>			
        	<td>
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;			
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			<input type="button" value="Cancel" onclick="javascript:history.go(-1)" />
			<input value="Continue" type='button' onclick="continues()" />				
        	<input value="Save" type='submit' />
        	</td>   
			<td>
        
        	</td>	
			<td>
        	</td>	
			<td nowrap="nowrap"></td>			
        </tr>	
   	
	</table>
</form>

    
<script type="text/javascript">   
		
	function createUploader(){  
		//Hiển thị thông tin giờ làm việc
		divideWorkingTimeString();			
		//add new a store
		var logo = new qq.FileUploader({
		element: document.getElementById('file-uploader-logo'),
		action: '/admin/store/upload',
		onComplete: function(id, fileName, responseJSON){
			fileName = responseJSON['fileName'];
			$(".qq-upload-list").remove();//gan duong dan vao elenment
			var img = document.getElementById('logofilename');
			img.value = "/upload/store/"+$.trim(fileName);
			$("#logo").remove(); 	
			$("#file-uploader-logo").find(".qq-upload-button").after("<img width='120' height='120' name='logo' id='logo' src='<?php echo $this->baseURL();?>/upload/store/"+$.trim(fileName)+ "' alt='Picture here'/>");
			}
		}); 
		var uploader1 = new qq.FileUploader({
			element: document.getElementById('file-uploader-demo1'),
			action: '/admin/store/upload',
			onComplete: function(id, fileName, responseJSON){
			    fileName = responseJSON['fileName'];
			    $(".qq-upload-list").remove();
			   	//gan duong dan vao elenment
				var img1 = document.getElementById('image1filename');
				img1.value = "/upload/store/"+$.trim(fileName);
				$("#image1").remove(); 	
				$("#file-uploader-demo1").find(".qq-upload-button").after("<img width='120' height='120' name='image1' id='image1' src='<?php echo $this->baseURL();?>/upload/store/"+$.trim(fileName)+ "' alt='Picture here'/>");
			}
		}); 
		var uploader2 = new qq.FileUploader({
			element: document.getElementById('file-uploader-demo2'),
			action: '/admin/store/upload',
			onComplete: function(id, fileName, responseJSON){
				fileName = responseJSON['fileName'];
				$(".qq-upload-list").remove();
				//gan duong dan vao elenment
				var img2 = document.getElementById('image2filename');
				img2.value = "/upload/store/"+$.trim(fileName);
				$("#image2").remove();						
				$("#file-uploader-demo2").find(".qq-upload-button").after("<img width='120' height='120' name='image2' id='image2' src='<?php echo $this->baseURL();?>/upload/store/"+$.trim(fileName)+ "' alt='Picture here'/>");
			}
		});
			
		var uploader3 = new qq.FileUploader({
			element: document.getElementById('file-uploader-demo3'),
			action: '/admin/store/upload',
			onComplete: function(id, fileName, responseJSON){
				fileName = responseJSON['fileName'];
				$(".qq-upload-list").remove();
				//gan duong dan vao elenment
				var img3 = document.getElementById('image3filename');
				img3.value = "/upload/store/"+$.trim(fileName);	
				$("#image3").remove();						
				$("#file-uploader-demo3").find(".qq-upload-button").after("<img width='120' height='120' name='image3' id='image3' src='<?php echo $this->baseURL();?>/upload/store/"+$.trim(fileName)+ "' alt='Picture here'/>");
			}
		}); 
	}
	
	function divideWorkingTimeString()
	{
		var storeid = document.getElementById("STOREID");
		//Test
		//storeid = 0;
		var workingtime=document.getElementById("WORKINGTIME").value;
		if( storeid.value == "" || storeid.value == 0)
		{
			return;
		}
		else
		{	
			var mytime_array=workingtime.split(",");
			//alert(mytime_array[0]+" "+mytime_array[1]+" "+mytime_array[2]);
			//thu 2
			setValueToWorkingTime("workingtime_hour2_from", mytime_array[0], 0);
			setValueToWorkingTime("workingtime_min2_from", mytime_array[0], 1);
			
			setValueToWorkingTime("workingtime_hour2_to", mytime_array[1], 0);
			setValueToWorkingTime("workingtime_min2_to", mytime_array[1], 1);
			//thu 3
			setValueToWorkingTime("workingtime_hour3_from", mytime_array[2], 0);
			setValueToWorkingTime("workingtime_min3_from", mytime_array[2], 1);
			
			setValueToWorkingTime("workingtime_hour3_to", mytime_array[3], 0);
			setValueToWorkingTime("workingtime_min3_to", mytime_array[3], 1);
				//thu 4
			setValueToWorkingTime("workingtime_hour4_from", mytime_array[4], 0);
			setValueToWorkingTime("workingtime_min4_from", mytime_array[4], 1);
			
			setValueToWorkingTime("workingtime_hour4_to", mytime_array[5], 0);
			setValueToWorkingTime("workingtime_min4_to", mytime_array[5], 1);
				//thu 5
			setValueToWorkingTime("workingtime_hour5_from", mytime_array[6], 0);
			setValueToWorkingTime("workingtime_min5_from", mytime_array[6], 1);
			
			setValueToWorkingTime("workingtime_hour5_to", mytime_array[7], 0);
			setValueToWorkingTime("workingtime_min5_to", mytime_array[7], 1);
				//thu 6
			setValueToWorkingTime("workingtime_hour6_from", mytime_array[8], 0);
			setValueToWorkingTime("workingtime_min6_from", mytime_array[8], 1);
			
			setValueToWorkingTime("workingtime_hour6_to", mytime_array[9], 0);
			setValueToWorkingTime("workingtime_min6_to", mytime_array[9], 1);
				//thu 7
			setValueToWorkingTime("workingtime_hour7_from", mytime_array[10], 0);
			setValueToWorkingTime("workingtime_min7_from", mytime_array[10], 1);
			
			setValueToWorkingTime("workingtime_hour7_to", mytime_array[11], 0);
			setValueToWorkingTime("workingtime_min7_to", mytime_array[11], 1);
				//chu nhat
			setValueToWorkingTime("workingtime_hour8_from", mytime_array[12], 0);
			setValueToWorkingTime("workingtime_min8_from", mytime_array[12], 1);
			
			setValueToWorkingTime("workingtime_hour8_to", mytime_array[13], 0);
			setValueToWorkingTime("workingtime_min8_to", mytime_array[13], 1);
		}
	}
	
	function setValueToWorkingTime(elementId, elementValue, index)
	{ 
		value = elementValue.split(":")[index]; 
		var dstElement = document.getElementById(elementId);
		if(value != "")
		{
			for (var i=0; i< dstElement.options.length; i++)
			{
				if ( dstElement.options[i].value == value )
				{	
					dstElement.options[i].selected = true;
					break;
				}
			}
		}
		else
		{
			dstElement.options[0].selected = true;
		}
	}
	
    function save(){
        var flag=0;
    	var name= document.getElementById('NAME');
    	if(name == null || name == ''){
        	alert('Tên cửa hàng không được trống.');
        	flag=1;
        	return;
        	}else{
        		flag=0;
            	}
    	if(flag==0){
				document.frm.submit();
        	}
    	else{
				return;
        	}
    }
	
	function xemBanDo(){
		alert("Die!!");
    }	
	
	function continues(){
		alert("Die!!");
    }
	
	function changedCity(cityid){
		//Ajax ở đây.		
		$.ajax({
		url: '/admin/store/selectdistrictbycityid/cityid/'+ cityid+'/districtid/<?php echo $this->data['DISTRICTID']?>',
		success: function(data) {
			if(data){
				$('#DISTRICTID').html('<option value="">-- Chọn quận huyện --</option>'+ data);
				}	
			else
				$('#DISTRICTID').html('<option value="">-- Chọn quận huyện --</option>');
			}
		});
	}
	<?php if($this->data['CITYID'] != 0) : ?>
		changedCity(<?php echo$this->data['CITYID']?>);
		//changedCity();
	<?php endif; ?>
		
	function back(){
        document.location.href='/admin/store/index';
    }
	
	function getsametime(index){		
		switch(index)
		{
			case 3:
				{
					WorkingTimeCopyValue('workingtime_hour2_from', 'workingtime_hour3_from');
					WorkingTimeCopyValue('workingtime_min2_from', 'workingtime_min3_from');
					WorkingTimeCopyValue('workingtime_hour2_to', 'workingtime_hour3_to');
					WorkingTimeCopyValue('workingtime_min2_to', 'workingtime_min3_to');
				}break;
			case 4:
				{
					WorkingTimeCopyValue('workingtime_hour3_from', 'workingtime_hour4_from');
					WorkingTimeCopyValue('workingtime_min3_from', 'workingtime_min4_from');
					WorkingTimeCopyValue('workingtime_hour3_to', 'workingtime_hour4_to');
					WorkingTimeCopyValue('workingtime_min3_to', 'workingtime_min4_to');
				}break;
			case 5:
				{
					WorkingTimeCopyValue('workingtime_hour4_from', 'workingtime_hour5_from');
					WorkingTimeCopyValue('workingtime_min4_from', 'workingtime_min5_from');
					WorkingTimeCopyValue('workingtime_hour4_to', 'workingtime_hour5_to');
					WorkingTimeCopyValue('workingtime_min4_to', 'workingtime_min5_to');
				}break;
			case 6:
				{
					WorkingTimeCopyValue('workingtime_hour5_from', 'workingtime_hour6_from');
					WorkingTimeCopyValue('workingtime_min5_from', 'workingtime_min6_from');
					WorkingTimeCopyValue('workingtime_hour5_to', 'workingtime_hour6_to');
					WorkingTimeCopyValue('workingtime_min5_to', 'workingtime_min6_to');
				}break;
			case 7:
				{
					WorkingTimeCopyValue('workingtime_hour6_from', 'workingtime_hour7_from');
					WorkingTimeCopyValue('workingtime_min6_from', 'workingtime_min7_from');
					WorkingTimeCopyValue('workingtime_hour6_to', 'workingtime_hour7_to');
					WorkingTimeCopyValue('workingtime_min6_to', 'workingtime_min7_to');
				}break;
			case 8:
				{
					WorkingTimeCopyValue('workingtime_hour7_from', 'workingtime_hour8_from');
					WorkingTimeCopyValue('workingtime_min7_from', 'workingtime_min8_from');
					WorkingTimeCopyValue('workingtime_hour7_to', 'workingtime_hour8_to');
					WorkingTimeCopyValue('workingtime_min7_to', 'workingtime_min8_to');
				}break;
			default: break;
		}
	}
	
	function WorkingTimeCopyValue(srcName, dstName)
	{	
		var srcElement = document.getElementById(srcName);
		var dstElement = document.getElementById(dstName);
		var srcvalue = srcElement.options[srcElement.selectedIndex].value;
		for (var i=0; i< dstElement.options.length; i++)
		{
			if ( dstElement.options[i].value == srcvalue )
			{	
				dstElement.options[i].selected = true;
				break;
			}
		}
	}
	
	
	// in your app create uploader as soon as the DOM is ready
	// don't wait for the window to load  
	window.onload = createUploader; 	
</script>
</body>
</html>